package com.neusoft.yuejian_6.model;

import com.neusoft.yuejian_6.javabean.Activity;
import com.neusoft.yuejian_6.javabean.Apply;
import com.neusoft.yuejian_6.service.ActivityService;

import java.util.List;

import retrofit2.Call;
import retrofit2.Callback;
import retrofit2.Response;
import retrofit2.Retrofit;
import retrofit2.converter.gson.GsonConverterFactory;

import static com.neusoft.yuejian_6.base.Constant.BASE_URL;



public class ActivityModel {
    private Retrofit retrofit;

    public ActivityModel() {
        retrofit = new Retrofit.Builder()
                .baseUrl(BASE_URL)
                .addConverterFactory(GsonConverterFactory.create())
                .build();
    }

    public Call<List<Activity>> Activity() {
        ActivityService activityService = retrofit.create(ActivityService.class);
        return activityService.getAllActivities();



    }
    public Call<Activity> getActivityById(int activity_id){
        ActivityService activityService=retrofit.create(ActivityService.class);
        return activityService.getActivityById(activity_id);
    }
    //报名活动
    public Call<Apply> addactivityn(int user_id, int activity_id){
        ActivityService activityService = retrofit.create(ActivityService.class);
        return activityService.addactivityn(user_id,activity_id);
    }
    //活动详情
    public Call<Activity> getDetail(int activity_id){
        ActivityService activityService = retrofit.create(ActivityService.class);
        return activityService.getDetail(activity_id);
    }


}
